import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GradeInfoVO, GradeInfoForm, GradeInfoQuery } from '@/api/office/grade/types';

/**
 * 查询年级信息列表
 * @param query
 * @returns {*}
 */

export const listGradeInfo = (query?: GradeInfoQuery): AxiosPromise<GradeInfoVO[]> => {
  return request({
    url: '/office/grade/list',
    method: 'get',
    params: query
  });
};

export const pageGradeInfo = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: '/office/grade/page',
    method: 'get',
    params: query
  });
};

/**
 * 查询年级信息详细
 * @param id
 */
export const getGradeInfo = (id: string | number): AxiosPromise<GradeInfoVO> => {
  return request({
    url: '/office/grade/' + id,
    method: 'get'
  });
};

/**
 * 新增年级信息
 * @param data
 */
export const addGradeInfo = (data: GradeInfoForm) => {
  return request({
    url: '/office/grade',
    method: 'post',
    data: data
  });
};

/**
 * 修改年级信息
 * @param data
 */
export const updateGradeInfo = (data: GradeInfoForm) => {
  return request({
    url: '/office/grade',
    method: 'put',
    data: data
  });
};

/**
 * 删除年级信息
 * @param id
 */
export const delGradeInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/office/grade/' + id,
    method: 'delete'
  });
};
